package code.main.view.hall
{
	import code.common.assets.AssetsClassName;
	import code.common.effects.Effects;
	
	import com.yy.manager.ResourceManager;
	import com.yy.tools.graphics.GT;
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;

	/**
	 *导航按钮项 
	 * @author YY
	 * 
	 */
	public class NavItem extends Sprite
	{
		private var _view:MovieClip;
		public function NavItem(label:String, ico:DisplayObject=null)
		{
			_view = ResourceManager.getMovieClipByName(AssetsClassName.NavItem);
			addChild(_view);
			GT.removeAllChild(_view.ico);
			if(ico) {
				_view.ico.addChild(ico);
			}
			if(label) {
				_view.label.text = label;
			}else {
				_view.label.text = "";
			}
			this.mouseChildren = false;
			this.buttonMode = true;
			addEvent();
			this.alpha = .6;
		}
		
		private function addEvent():void {
			this.addEventListener(MouseEvent.MOUSE_OVER, overFunc);
			this.addEventListener(MouseEvent.MOUSE_OUT, outFunc);
		}
		
		private function overFunc(e:Event):void {
			this.alpha = 1;
			DisplayObject(_view.ico).filters = Effects.STROKE_FILTER;
		}
		private function outFunc(e:Event):void {
			this.alpha = .8;
			DisplayObject(_view.ico).filters = null;
		}
	}
}